package com.mostromas.ess.project.service.impl;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mostromas.ess.entities.ProjectDetailed;
import com.mostromas.ess.project.mapper.ProjectDetailedMapper;
import com.mostromas.ess.project.req.ProjectDetailedREQ;
import com.mostromas.ess.project.service.IProjectDetailedService;
import com.mostromas.ess.util.base.Result;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

@Service
public class ProjectDetailedServiceImpl extends ServiceImpl<ProjectDetailedMapper, ProjectDetailed> implements IProjectDetailedService {

    /**
     * 根据条件查询软件信息
     * @param req
     * @return
     */
    @Override
    public Result queryList(ProjectDetailedREQ req) {
        QueryWrapper<ProjectDetailed> wrapper = new QueryWrapper<>();
        if(StringUtils.isNotEmpty(req.getName())) {
            wrapper.like("name", req.getName());
        }
        if(StringUtils.isNotEmpty(req.getAbbreviation())) {
            wrapper.like("abbreviation", req.getAbbreviation());
        }
        return Result.ok(baseMapper.selectList(wrapper));
    }
}
